﻿@{
    ViewBag.Title = ViewBag.CurBlogUserName + "的随笔 - 小博客";
    Layout = "~/Views/Shared/_BlogLayout.cshtml";
}
@model PagedList<ArticleModel>
@using MyBlog

<div style="padding:5px;">
    <div class="index-left2">
        <div class="dv-query">@ViewBag.tip</div>
        @if (Model.Count == 0)
            {
                if (ViewBag.CanEdit)
                {
                <span class="dv-none-tip">暂无随笔~现在去 <a href="@Url.Action("release")"><i class="icon-edit"></i>发布</a></span>
            }
            else
            {
                <span class="dv-none-tip">博主很懒，暂时还没有写过随笔~</span>
            }
        }
        else
        {

            foreach (var item in Model)
            {
                <div class="dv-article">
                    <h3><a href="@Url.Action("article/"+item.ID)">@(item.IsTop ? "[置顶]" + item.Title : item.Title)</a></h3>
                    <p>@(string.IsNullOrWhiteSpace(item.Profile) ? item.Content.StripHTML().SubStr(500) : item.Profile)  <a class="read-all" href="@Url.Action("article/"+item.ID)">阅读全文</a></p>
                    <div class="index-article-tip">
                        <div class="index-article-tags">
                            <i class="icon-tags"></i> 标签：
                            @if (item.TagModels.Count > 0)
                            {
                                foreach (var t in item.TagModels)
                                {
                                    <a title="查看标签为[@(t.TagName)]的文章" href="@Url.Action("articles",new {tagID=t.ID })">@t.TagName</a>
                                }
                            }
                            else
                            {
                                @:暂无标签
                }
                        </div>
                        <div class="autor">
                            <span><i class="icon-time"></i> @item.CreateTime.ToString("yyyy年MM月dd日")</span>
                            <span><i class="icon-comments"></i> 评论(<a href="@Url.Action("article/"+item.ID)">@item.ArticleCommentModels.Count</a>)</span>
                            <span><i class="icon-eye-open"></i> 阅读(<a href="@Url.Action("article/"+item.ID)">@item.ReadCount</a>)</span>
                        </div>
                    </div>
                </div>
            }
            <div class="dv-article-page">
                <span class="sp-page-tip">第@(Model.CurrentPageIndex)页&nbsp;&nbsp;&nbsp;共@(Model.TotalItemCount)条记录</span>
                @if (Model.CurrentPageIndex > 1)
                {
                    <a class="sp-page" href="@Url.Action("articles",new { cid=ViewBag.cid,isMonth=ViewBag.isMonth,begin=ViewBag.begin,page=Model.CurrentPageIndex-1 })">上一页</a>
                }
                @if ((Model.CurrentPageIndex > 1 && Model.CurrentPageIndex < Model.TotalPageCount)
                || (Model.TotalPageCount > 1 && (Model.CurrentPageIndex < Model.TotalPageCount || Model.CurrentPageIndex == 1)))
                {
                    <a class="sp-page" href="@Url.Action("articles",new { cid=ViewBag.cid,isMonth=ViewBag.isMonth,begin=ViewBag.begin,page=Model.CurrentPageIndex+1 })">下一页</a>
                }
            </div>
        }
    </div>
    <div class="dright" id="blog-comm-right">
        @{Html.RenderAction("_BlogCommonRight"); }
    </div>
</div>